<!DOCTYPE html>
<#include "/ftl/header.ftl">

<script type="text/javascript">
    $(document).ready(function () {
        var E = window.wangEditor
        var editor = new E('#editor')
        editor.customConfig.uploadImgShowBase64 =false
        editor.customConfig.onchange = function (html) {
            // 监控变化，同步更新到 textarea
            console.log(html)
            $("#content").val(html);
        }

        editor.create()

    });
    function back() {
        window.history.back(-1); //返回上一页
    }
</script>

<#include "/ftl/menu.ftl">
<body>
<div class="container">
    <div class="row">
        <div class="col-md-12">
            <ol class="breadcrumb">
                <li><a href="#">文章管理</a></li>
                <li><a href="#">文章列表</a></li>
                <li class="active">文章修改</li>
            </ol>
        </div>
    </div>
    <div style="display:inline">
        <form  method="post"  enctype="multipart/form-data" id="formData">
            <div class="content controls npt text-center">

                <div class="col-md-7">
                    <div class="block">
                        <input type="hidden" name="freeArticleId" value="${freeArticle.freeArticleId}" />
                        <input type="hidden" name="type" value="${freeArticle.type!}" />
                        <div class="content controls">
                            <div class="form-row">
                                <div class="col-md-1">标题<span style="color: red">*</span></div>
                                <div class="col-md-9"><input type="text" class="form-control" id="title" name="title" value="${freeArticle.title!}" ></input></div>
                            </div>
                            <div class="form-row">
                                <div class="col-md-1">属性</div>
                                <div class="col-md-9"><input type="text" class="form-control" id="attribute" name="attribute" value="${freeArticle.attribute!}"  ></input></div>
                            </div>
                            <div class="form-row">
                                <div class="col-md-1">概要<span style="color: red">*</span></div>
                                <div class="col-md-9"><input type="text" class="form-control" id="summary" name="summary" value="${freeArticle.summary!}" ></input></div>
                            </div>
                            <div class="form-row">
                                <div class="col-md-1">链接<span style="color: red">*</span></div>
                                <div class="col-md-9"><input type="text" class="form-control" disabled="disabled" id="contentUrl" name="contentUrl" value="${freeArticle.contentUrl!}" ></input></div>
                            </div>

                    <div class="form-row">
                        <div class="col-md-1">内容<span style="color: red">*</span></div>
                        <div class="col-md-9" id="editor">
                            ${freeArticle.content!}
                        </div>
                        <input type="hidden"  id="content" name="content"  value='${freeArticle.content!}'>

                    </div>
                            <div class="form-row">
                                <div class="col-md-1">封面<span style="color: red">*</span></div>
                                <div class="col-md-9"><input type="hidden" class="form-control" id="imageUrl" name="imageUrl"  value="${freeArticle.imageUrl!}"></input></div>
                                <div class="col-md-9"><input type="file" class="form-control" id="file" name="file"  ></input></div>
                                <#if freeArticle.imageUrl?? >   <div class="col-md-5"><image  style="width:50px; height: 50px;" src="${freeArticle.imageUrl!}"></image>  </#if>
                            </div>
                            </div>
                    <div class="form-row">
                        <div  class="col-md-5">
                        </div>
                        <div class="col-md-6">
                            <input class="col-md-2  btn btn-default btn-clean"   type="submit" value="添加">
                            <button class="btn btn-default btn-clean"   onclick="back()" type="button">返回</button>
                        </div>

                    </div>
                </div>
            </div>
    </div>

</form>
</div>
<div style="float:left; display:inline">
<div style="margin-left:20px;margin-top:20px;">
    右键图片复制链接插入文本中
</div>
<div  style="height:400px;width:250px;overflow:auto" >

    <#if imageList??>
    <#list imageList as image>
    <div >
        <image style="margin-left:20px;margin-top:20px;width:200px;height:200px;" src="${image.imageUrl!}"></image>
    </div>
</#list>
</#if>
</div>
</div>

</body>
</html>